package com.molichuxing.gateway.bff.basic.convertor;

import java.util.ArrayList;
import java.util.List;

import com.molichuxing.gateway.bff.basic.entity.response.*;
import com.molichuxing.gateway.bff.car.entity.response.RegionSubcompanyVo;
import com.molichuxing.gateway.bff.permission.entity.response.AccountCreateVo;
import com.molichuxing.services.business.dto.response.VehicleInfoBizDto;
import com.molichuxing.services.infrastructure.dto.request.create.*;
import com.molichuxing.services.infrastructure.dto.request.modify.IovModifyAccountDto;
import com.molichuxing.services.infrastructure.dto.response.*;
import org.springframework.beans.BeanUtils;

import com.molichuxing.framework.dto.Paged;
import com.molichuxing.framework.dto.UploadFileRequestDto;
import com.molichuxing.services.business.dto.response.VehicleModlemakeBizDto;
import com.molichuxing.services.infrastructure.dto.request.modify.SubcompanyModifyDto;

public class Convert {

	public static List<InsuranceCompanyVo> toInsuranceCompanyVoList(List<InsuranceCompanyDto> beanList) {
		List<InsuranceCompanyVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (InsuranceCompanyDto bean : beanList) {
				dtoList.add(toInsuranceCompanyVoList(bean));
			}
		}
		return dtoList;
	}

	public static InsuranceCompanyVo toInsuranceCompanyVoList(InsuranceCompanyDto bean) {
		InsuranceCompanyVo beanDto = null;
		if (bean != null) {
			beanDto = new InsuranceCompanyVo();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}


	public static List<PurchaseParamDicVo> toPurchaseParamDicVo(List<PurchaseParamDicDto> beanList) {
		List<PurchaseParamDicVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (PurchaseParamDicDto bean : beanList) {
				dtoList.add(toPurchaseParamDicVo(bean));
			}
		}
		return dtoList;
	}

	public static PurchaseParamDicVo toPurchaseParamDicVo(PurchaseParamDicDto bean) {
		PurchaseParamDicVo beanDto = null;
		if (bean != null) {
			beanDto = new PurchaseParamDicVo();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}


	public static RegionCityVo toRegionCityVo(RegionCityDto bean) {
		RegionCityVo beanDto = null;
		if (bean != null) {
			beanDto = new RegionCityVo();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static List<RegionCityVo> toRegionCityVoList(List<RegionCityDto> beanList) {
		List<RegionCityVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (RegionCityDto bean : beanList) {
				dtoList.add(toRegionCityVo(bean));
			}
		}
		return dtoList;
	}

	public static List<SubcompanyVo> toSubcompanyVoVoList(List<SubcompanyDto> beanList) {
		List<SubcompanyVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (SubcompanyDto bean : beanList) {
				dtoList.add(toSubcompanyVo(bean));
			}
		}
		return dtoList;
	}

	public static SubcompanyVo toSubcompanyVo(SubcompanyDto bean) {
		SubcompanyVo beanDto = null;
		if (bean != null) {
			beanDto = new SubcompanyVo();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static SubcompanyCreateDto toSubcompanyCreateDto(SubcompanyVo bean) {
		SubcompanyCreateDto beanDto = null;
		if (bean != null) {
			beanDto = new SubcompanyCreateDto();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static SubcompanyModifyDto toSubcompanyModifyDto(SubcompanyVo bean) {
		SubcompanyModifyDto beanDto = null;
		if (bean != null) {
			beanDto = new SubcompanyModifyDto();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static Paged<SubcompanyVo> toPagedSubcompanyVo(Paged<SubcompanyDto> bean) {
		Paged<SubcompanyVo> beanDto = null;
		if (bean != null) {
			beanDto = new Paged<SubcompanyVo>();
			BeanUtils.copyProperties(bean, beanDto);
			beanDto.setList(toSubcompanyVoVoList(bean.getList()));
		}
		return beanDto;
	}

	public static Paged<OwnershipVo> toPagedOwnershipVo(Paged<OwnershipDto> bean) {
		Paged<OwnershipVo> beanDto = null;
		if (bean != null) {
			beanDto = new Paged<OwnershipVo>();
			BeanUtils.copyProperties(bean, beanDto);
			beanDto.setList(toOwnershipVoList(bean.getList()));
		}
		return beanDto;
	}

	public static List<OwnershipVo> toOwnershipVoList(List<OwnershipDto> beanList) {
		List<OwnershipVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (OwnershipDto bean : beanList) {
				dtoList.add(toOwnershipVo(bean));
			}
		}
		return dtoList;
	}

	public static OwnershipVo toOwnershipVo(OwnershipDto bean) {
		OwnershipVo beanDto = null;
		if (bean != null) {
			beanDto = new OwnershipVo();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static OwnershipCreateDto toOwnershipCreateDto(OwnershipVo bean) {
		OwnershipCreateDto beanDto = null;
		if (bean != null) {
			beanDto = new OwnershipCreateDto();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static OwnershipModifyDto toOwnershipModifyDto(OwnershipVo bean) {
		OwnershipModifyDto beanDto = null;
		if (bean != null) {
			beanDto = new OwnershipModifyDto();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static FileStorageConfigVo toFileStorageConfigVo(FileStorageConfigDto beanDto) {
		FileStorageConfigVo beanVo = null;
		if (beanDto != null) {
			beanVo = new FileStorageConfigVo();
			BeanUtils.copyProperties(beanDto, beanVo);
		}
		return beanVo;
	}

	public static UploadFileRequestDto toUploadFileRequestDto(FileStorageConfigDto beanDto) {
		UploadFileRequestDto beanVo = null;
		if (beanDto != null) {
			beanVo = new UploadFileRequestDto();
			BeanUtils.copyProperties(beanDto, beanVo);
		}
		return beanVo;
	}

	public static List<VehicleModlemakeVo> toVehicleModlemakeVo(List<VehicleModlemakeBizDto> beanList) {
		List<VehicleModlemakeVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (VehicleModlemakeBizDto bean : beanList) {
				dtoList.add(toVehicleModlemakeVo(bean));
			}
		}
		return dtoList;
	}

	public static VehicleModlemakeVo toVehicleModlemakeVo(VehicleModlemakeBizDto bean) {
		VehicleModlemakeVo beanDto = null;
		if (bean != null) {
			beanDto = new VehicleModlemakeVo();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static List<VehicleMakeVo> toVehicleMakeVo(List<VehicleMakeDto> beanList) {
		List<VehicleMakeVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (VehicleMakeDto bean : beanList) {
				dtoList.add(toVehicleMakeVo(bean));
			}
		}
		return dtoList;
	}

	public static VehicleMakeVo toVehicleMakeVo(VehicleMakeDto bean) {
		VehicleMakeVo beanDto = null;
		if (bean != null) {
			beanDto = new VehicleMakeVo();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

	public static List<ReceiptCompanyVo> toReceiptCompanyVo(List<ReceiptCompanyDto> dtoList) {
		List<ReceiptCompanyVo> voList = null;
		if (dtoList != null) {
			voList = new ArrayList<>();
			for (ReceiptCompanyDto beanDto : dtoList) {
				ReceiptCompanyVo beanVo = new ReceiptCompanyVo();
				BeanUtils.copyProperties(beanDto, beanVo);
				beanVo.setCompanyId(beanDto.getId());
				beanVo.setBanks(toReceiptCompanyBankVo(beanDto.getBanks()));
				voList.add(beanVo);
			}
		}

		return voList;
	}

	public static List<ReceiptCompanyBankVo> toReceiptCompanyBankVo(List<ReceiptCompanyBankDto> dtoList) {
		List<ReceiptCompanyBankVo> voList = null;
		if (dtoList != null) {
			voList = new ArrayList<>();
			for (ReceiptCompanyBankDto beanDto : dtoList) {
				ReceiptCompanyBankVo beanVo = null;
				if (beanDto != null) {
					beanVo = new ReceiptCompanyBankVo();
					BeanUtils.copyProperties(beanDto, beanVo);
					voList.add(beanVo);
				}
			}
		}

		return voList;
	}


	public static List<RegionSubcompanyVo> toRegionSubcompanyVo(List<RegionSubcompanyDto> beanList) {
		List<RegionSubcompanyVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (RegionSubcompanyDto bean : beanList) {
				dtoList.add(toRegionSubcompanyVo(bean));
			}
		}
		return dtoList;
	}

	public static RegionSubcompanyVo toRegionSubcompanyVo(RegionSubcompanyDto bean) {
		RegionSubcompanyVo beanDto = null;
		if (bean != null) {
			beanDto = new RegionSubcompanyVo();
			BeanUtils.copyProperties(bean, beanDto);
			beanDto.setId(bean.getRegionId());
			beanDto.setSubCompanyDto(toSubcompanyVoVoList(bean.getSubCompanyDto()));
		}
		return beanDto;
	}

	public static IovCreateAccountDto toIovCreateAccountDto(AccountCreateVo vo) {
		IovCreateAccountDto beanDto = null;
		if (vo != null) {
			beanDto = new IovCreateAccountDto();
			beanDto.setEmail(vo.getAccount());
			beanDto.setRealName(vo.getRealName());
			beanDto.setRoleId(vo.getIovGroupId());
			beanDto.setStatus(vo.getStatus() == 0 ? 1 : 0);
			beanDto.setUserPhone(vo.getUserPhone());
		}
		return beanDto;
	}

	public static IovModifyAccountDto toIovModifyAccountDto(AccountCreateVo vo) {
		IovModifyAccountDto beanDto = null;
		if (vo != null) {
			beanDto = new IovModifyAccountDto();
			beanDto.setAccount(vo.getAccount());
			beanDto.setRealName(vo.getRealName());
			beanDto.setRoleId(vo.getIovGroupId());
			beanDto.setStatus(vo.getStatus() == 0 ? 1 : 0);
			beanDto.setUserPhone(vo.getUserPhone());
		}
		return beanDto;
	}

	public static VersionMobileVo toVersionMobileVo(VersionMobileDto beanDto) {
		VersionMobileVo beanVo = null;
		if (beanDto != null) {
			beanVo = new VersionMobileVo();
			BeanUtils.copyProperties(beanDto, beanVo);
		}

		return beanVo;
	}


	public static List<VehicleModleMakeInfoVo> toVehicleModleMakeInfoVoList(List<VehicleInfoBizDto> beanList) {
		List<VehicleModleMakeInfoVo> dtoList = null;
		if (beanList != null && beanList.size() > 0) {
			dtoList = new ArrayList<>();
			for (VehicleInfoBizDto bean : beanList) {
				dtoList.add(toVehicleModleMakeInfoVo(bean));
			}
		}
		return dtoList;
	}

	public static VehicleModleMakeInfoVo toVehicleModleMakeInfoVo(VehicleInfoBizDto bean) {
		VehicleModleMakeInfoVo beanDto = null;
		if (bean != null) {
			beanDto = new VehicleModleMakeInfoVo();
			BeanUtils.copyProperties(bean, beanDto);
		}
		return beanDto;
	}

}
